home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet internetowy / Rozne / HTTrack 3.40-2 / httrack-3.40-2.exe / {app} / src_win / WinHTTrack / HtmlFrm.cpp < prev    next >
C/C++ Source or Header  |  2001-10-28  |  3KB  |  116 lines

  1. // mainfrm.cpp : implementation of the CHtmlFrame class
  2. //
  3.  
  4.  
  5. #include "stdafx.h"
  6. #include "htmlfrm.h"
  7. #include "resource.h"
  8.  
  9. #include "HTMLHelp.h"
  10.  
  11.  
  12. IMPLEMENT_DYNCREATE(CHtmlFrame, CMDIFrameWnd)
  13. BEGIN_MESSAGE_MAP(CHtmlFrame, CMDIFrameWnd)
  14.     //{{AFX_MSG_MAP(CHtmlFrame)
  15.     ON_WM_CREATE()
  16.     //}}AFX_MSG_MAP
  17. END_MESSAGE_MAP()
  18.  
  19. static UINT BASED_CODE buttons[] =
  20. {
  21.     // same order as in the bitmap 'toolbar.bmp'
  22.     ID_FILE_NEW, ID_FILE_OPEN, ID_FILE_SAVE, 0,
  23.     ID_EDIT_CUT, ID_EDIT_COPY, ID_EDIT_PASTE, 0,
  24.     ID_FILE_PRINT, ID_APP_ABOUT,
  25. };
  26.  
  27. static UINT BASED_CODE indicators[] =
  28. {
  29.     0, ID_INDICATOR_CAPS, ID_INDICATOR_NUM, ID_INDICATOR_SCRL,
  30. };
  31.  
  32. int CHtmlFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  33. {
  34.     if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
  35.         return -1;
  36.  
  37.   /*
  38.     if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
  39.         | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
  40.         !m_wndToolBar.LoadToolBar(IDR_HELPFRM))
  41.     {
  42.         TRACE0("Failed to create toolbar\n");
  43.         return -1;      // fail to create
  44.     }
  45. */
  46.  
  47.     if (!m_wndStatusBar.Create(this) ||
  48.         !m_wndStatusBar.SetIndicators(indicators,
  49.           sizeof(indicators)/sizeof(UINT)))
  50.     {
  51.         TRACE0("Failed to create status bar\n");
  52.         return -1;      // fail to create
  53.     }
  54.  
  55.     // TODO: Delete these three lines if you don't want the toolbar to
  56.     //  be dockable
  57. /*
  58.     m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
  59.     EnableDocking(CBRS_ALIGN_ANY);
  60.     DockControlBar(&m_wndToolBar);
  61.   */
  62.  
  63.   CHTMLHelp foo;
  64.   RECT toto;
  65.   toto.bottom=toto.right=0;
  66.   toto.top=toto.left=600;
  67.   foo.Create(NULL,NULL,WS_CHILD,toto,this,0);
  68.   //SetActiveView(&foo);
  69.  
  70.   return 0;
  71. }
  72.  
  73. /////////////////////////////////////////////////////////////////////////////
  74. // Helpers for saving/restoring window state
  75.  
  76. static TCHAR BASED_CODE szSection[] = _T("Settings");
  77. static TCHAR BASED_CODE szWindowPos[] = _T("WindowPos");
  78. static TCHAR szFormat[] = _T("%u,%u,%d,%d,%d,%d,%d,%d,%d,%d");
  79.  
  80. static BOOL PASCAL NEAR ReadWindowPlacement(LPWINDOWPLACEMENT pwp)
  81. {
  82.     CString strBuffer = AfxGetApp()->GetProfileString(szSection, szWindowPos);
  83.     if (strBuffer.IsEmpty())
  84.         return FALSE;
  85.  
  86.     WINDOWPLACEMENT wp;
  87.     int nRead = _stscanf(strBuffer, szFormat,
  88.         &wp.flags, &wp.showCmd,
  89.         &wp.ptMinPosition.x, &wp.ptMinPosition.y,
  90.         &wp.ptMaxPosition.x, &wp.ptMaxPosition.y,
  91.         &wp.rcNormalPosition.left, &wp.rcNormalPosition.top,
  92.         &wp.rcNormalPosition.right, &wp.rcNormalPosition.bottom);
  93.  
  94.     if (nRead != 10)
  95.         return FALSE;
  96.  
  97.     wp.length = sizeof wp;
  98.     *pwp = wp;
  99.     return TRUE;
  100. }
  101.  
  102. static void PASCAL NEAR WriteWindowPlacement(LPWINDOWPLACEMENT pwp)
  103.     // write a window placement to settings section of app's ini file
  104. {
  105.     TCHAR szBuffer[sizeof("-32767")*8 + sizeof("65535")*2];
  106.  
  107.     wsprintf(szBuffer, szFormat,
  108.         pwp->flags, pwp->showCmd,
  109.         pwp->ptMinPosition.x, pwp->ptMinPosition.y,
  110.         pwp->ptMaxPosition.x, pwp->ptMaxPosition.y,
  111.         pwp->rcNormalPosition.left, pwp->rcNormalPosition.top,
  112.         pwp->rcNormalPosition.right, pwp->rcNormalPosition.bottom);
  113.     AfxGetApp()->WriteProfileString(szSection, szWindowPos, szBuffer);
  114. }
  115.  
  116.